package ace.cmp.security.api;

/**
 * @author caspar
 * @date 2023/8/26 15:21 安全架构基础接口
 */
public interface SecurityService<TAuthentication, TCredentials> {
  boolean hasAuthority(String authority);

  boolean hasAnyAuthority(String... authorities);

  /**
   * default login method
   *
   * @return login success result
   */
  TAuthentication login();

  /**
   * login by credentials
   *
   * @param credentials login credentials
   * @return login success result
   */
  TAuthentication login(TCredentials credentials);

  /**
   * get login success authentication object
   *
   * @return authentication success object
   */
  TAuthentication getAuthentication();

  boolean isAnonymous();

  boolean isSuperAdministrator();
}
